﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace S4Store.Models.Report
{
    public class SaleTimeRateModel : BaseReportModel
    {

        public int DayCount { get; set; }
        public int Day { get; set; }
        public decimal DateRate
        {
            get
            {
                return (decimal)Day * (decimal)100 / (decimal)DayCount;
            }
        }

        /// <summary>
        /// 订单数
        /// </summary>
        public int OrderCount { get; set; }
        /// <summary>
        /// 月底目标订单数
        /// </summary>
        public int MonthTargetOrderCount { get; set; }
        /// <summary>
        /// 现在应该订单数
        /// </summary>
        public int TargetOrderCount
        {
            get
            {
                return (DateRate/100*MonthTargetOrderCount).AutoCeling();
            }
        }
        /// <summary>
        /// 订单完成比例
        /// </summary>
        public decimal OrderRate
        {
            get
            {
                if (MonthTargetOrderCount == 0) return 100;
                return (decimal)OrderCount * 100 / (decimal)MonthTargetOrderCount;
            }
        }


        /// <summary>
        /// 销量数
        /// </summary>
        public int SaleCount { get; set; }
        /// <summary>
        /// 月底目标销量数
        /// </summary>
        public int MonthTargetSaleCount { get; set; }
        /// <summary>
        /// 现在应该销量数
        /// </summary>
        public int TargetSaleCount
        {
            get
            {
                return (DateRate / 100 * MonthTargetSaleCount).AutoCeling();
            }
        }
        /// <summary>
        /// 销量完成比例
        /// </summary>
        public decimal SaleRate
        {
            get
            {
                if (MonthTargetSaleCount == 0) return 100;
                return (decimal)SaleCount * 100 / (decimal)MonthTargetSaleCount;
            }
        }

    }
}